package com.cy.pj.um.controller;

import com.cy.pj.um.pojo.Brand;
import com.cy.pj.um.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class BrandController {
    @Autowired
    private BrandService brandService;
    @RequestMapping({"doFindAll/{name}","doFindAll"})
    public String doFindAll(@PathVariable(required = false) String name, Model model){
        List<Brand> list = brandService.doFindAll(name);
        model.addAttribute("list",list);
        return "brand";
    }
}
